import request from '@/utils/request'

// 首页数据
export function indexBoard(query) {
  return request({
    url: '/system/home/top',
    method: 'get',
    params: query
  })
}

// 查询警报列表
export function panelList(query) {
  return request({
    url: '/system/panel/list',
    method: 'get',
    params: query
  })
}

// add看板
export function panelAdd(data) {
  return request({
    url: '/system/panel',
    method: 'post',
    data: data
  })
}

// 详情
export function panelDetail(id) {
  return request({
    url: '/system/panel/' + id,
    method: 'get'
  })
}

// edit警报
export function panelEdit(data) {
  return request({
    url: '/system/panel',
    method: 'put',
    data: data
  })
}

// delete警报
export function panelDelete(id) {
  return request({
    url: '/system/panel/' + id,
    method: 'delete'
  })
}

// 看板组件列表
export function panelComponentsList(query) {
  return request({
    url: '/system/paneldetail/list',
    method: 'get',
    params: query
  })
}

// 看板组件详情
export function panelComponentsAdd(data) {
  return request({
    url: '/system/paneldetail',
    method: 'post',
    data: data
  })
}

// 编辑单个组件
export function panelComponentsEditOne(data) {
  return request({
    url: '/system/paneldetail',
    method: 'put',
    data: data
  })
}

// 看板组件详情
export function panelComponentsDetail(id) {
  return request({
    url: '/system/paneldetail/' + id,
    method: 'get',
  })
}

// 看板组件编辑
export function panelComponentsEdit(data) {
  return request({
    url: '/system/paneldetail/edit',
    method: 'post',
    data: data
  })
}

// 看板组件编辑
export function panelComponentsRemove(id) {
  return request({
    url: '/system/paneldetail/' + id,
    method: 'delete',
  })
}

// 看板单个数据，当前值
export function paneldetailData(query) {
  return request({
    url: '/system/paneldetail/data',
    method: 'get',
    params: query
  })
}

// 折线图多个数据组合 按小时平均数据
export function paneldetailList(query) {
  return request({
    url: '/system/paneldetail/datalist',
    method: 'get',
    params: query
  })
}

// 历史折线图
export function paneldetailHistoryList(query) {
  return request({
    url: '/system/paneldetail/datalist2',
    method: 'get',
    params: query
  })
}

// 开关下发指令
export function deviceCommandDown(data) {
  return request({
    url: '/system/device/command',
    method: 'post',
    data: data
  })
}
